'use strict';

const Controller = require('egg').Controller;

class ApiController extends Controller {
  async login() {
    const { ctx } = this
    const { username, password } = this.ctx.request.body
    await ctx.helper.sleepPromise()
    ctx.body = await this.service.login.doLogin({ username, password })
  }
  async getUser() {
    const { ctx } = this
    const { token } = ctx.query
    await ctx.helper.sleepPromise()
    ctx.body = await this.service.login.getUserByToken({ token })
  }
}

module.exports = ApiController;
